package com.yuji.aacar.net.exception;

/**
 * <li>Date: 2017/2/24 </li>
 * <li>Description: </li>
 * <br> 异常处理的基类，根据请求码返回所有业务异常 </br>
 */

public abstract class BaseHttpException extends RuntimeException {
    private int errorCode;
    private String errorMessage;

    public BaseHttpException() {
    }

    public BaseHttpException(String detailMessage) {
        super(detailMessage);
        this.setErrorMessage(detailMessage);
    }

    public BaseHttpException(int errorCode, String detailMessage) {
        super(detailMessage);
        this.setCode(errorCode);
        this.setErrorMessage(detailMessage);
    }

    public int getCode() {
        return errorCode;
    }

    public void setCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    @Override
    public String toString() {
        return "BaseHttpException{" +
                "errorCode=" + errorCode +
                ", errorMessage='" + errorMessage + '\'' +
                '}';
    }
}
